fn odd(number: u32) -> bool {
    // for i in 2..(number as f64).sqrt() as u32 {
    //     if number % i == 0 {
    //         return false;
    //     }
    // }
    // true
    // 
    number % 2!= 0
}

pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    let mut fib:Vec<u32> = vec![0,1,1];
    let mut index = 2;
    // let mut tail = fib[2];
    loop {
        let next = fib[index]+fib[index-1];
        if next > threshold {
            break;
        }
        fib.push(next);
        index += 1;
        // tail = fib[index];
    }
    let mut sum: u32 = 0;
    for i in fib {
        if odd(i) {
            sum += i;
        }
        // print!("{:?} ", i);
    }
    // println!("");
    sum
}
